home *** CD-ROM | disk | FTP | other *** search
- Charles Esson writes:
- > Would this only occure if the same physical address was mapped into
- > different virtual addresses with write enabled. I see it as a
- > reasonable restiction that virtual be mapped to the real on a one to one
- > basis when write is enabled.
-
- But the cache works on VIRTUAL ADDRESSES NOT PHYSICAL! If the processor
- finds a cache entry for the virtual (program) address, then it *will*
- use it! It doesn't care about the mapping. The reason for this is that
- the processor/cache/mmu work as follows:
-
- Processor wants to read a word.
- - cache gets searched (always, whether caching is enabled or not).
- if entry is found, use it.
- - if no entry is found, use the mmu to obtain data. If caching
- is enabled, insert this data into the cache.
-
- The data sections have to use different physical pages for data for
- different tasks. Let's say that two task fopen's a file. FILE * is
- returned from an array of FILE *filp[]. filp would be located in the
- shared library.
-
- > To use fixed address libaries code one could you put aside the fixed
- > addresses required for these libaries. The MMU would then map the
- > virtual into real as the libs are used. Problems would arise if the libs
- > have data sections that have to be mapped to different physical
- > addresses for different tasks. I have always assumed the libs use stack
- > and heap space from the calling task but perhaps this is a bad
- > assumption.
-
- On fopen'ing, both tasks believe that the third entry is free. You
- use that entry. One task writes address 0x9a40 into it, the other
- writes 0x9a20. Immediately, one task has the wrong data available to
- it.
-
- Malloc() does extend the BSS segment on the binary, extending it towards
- the shared library.
-
- > You would have to allocate the virtual address space out of a system
- > pool on task loading, but you could still map to one physical page as
- > long as it was write protected.
-
- I will quote from the StrongARM data sheet:
-
- The Dcache operates with virtual addresses, so care must be taken to
- ensure that its contents remain consistent with the virtual to physical
- mappings performed by the memory management unit. If the memory mappings
- are changed, the Dcache validity must be ensured.
-
- On a task switch, the virtual to physical address mappings are changed
- to map in the new tasks text segment into 0x8000, so whatever you do with
- libraries or anything (unless you're only running multiple copies of the
- same program) you HAVE to flush the cache. You can't get away from it!
- No way out!
-
- > I see code being sharable, data non sharable, and stacks a bit of a
- > problem as you can't allocate them in the middle of nowhere, you have to
- > get some virtual space from the operating system when the task is
- > created, and the operating system has to be given some hint about the
- > stack size required. To make this work ELF would have to tell me what is
- > read only and what is read/write. Further linux would have to keep this
- > info for the fork, but I think this is the case.
- >
- > I have assumed that ZERO_PAGE is write and read protected so you can
- > allocate real memory if you actually access it. If this is the case
- > would PAGE_ZERO ever get read or written to be cached. Does ZERO_PAGE
- > really have to be mapped to real memory.
-
- Are you really sure that you want to use Linux for this? It sounds like
- you're basically going to have to re-write the whole of the memory
- management system (and therefore the mmap()ing of the filesystems)!
- _____
- |_____| ------------------------------------------------- ---+---+-
- | | Russell King rmk92@ecs.soton.ac.uk --- ---
- | | | | http://whirligig.ecs.soton.ac.uk/~rmk92/home.html / / |
- | +-+-+ --- -+-
- / | THE developer of ARM Linux |+| /|\
- / | | | * who wishes that he was in Hong Kong * --- |
- +-+-+ ------------------------------------------------- /\\\ |
-
-